<?php 
//include 'Model.class.php';
class userheadModel extends Model
{
	private $tb='userhead';

	public function add($data)
	{
		if($this->db->insert('userhead',$data))
		{
			return $this->db->insert_id();
		}
		return false;
	}
	public function insert($sql)
	{
		if($this->db->set_query($sql))
		{
			return $this->db->insert_id();
		}
		return false;
	}
	//修改某个字段值
	public function modify($uid,$attr,$val)
	{
		$sql="update $this->tb set $attr='$val' where id=$uid";
		if($this->db->set_query($sql))
		{
			return $this->db->affect_row();
		}
		return false;
	}
	//获取单个字段值
	public function getAttr($uid,$attr)
	{
		$sql="select $attr from $this->tb where id=$uid";
		return $this->db->getOne($sql);
	}

	public function getall()
	{
		$sql="select * from $this->tb";
		return $this->db->getAll($sql);
	}

	public function getgif()
	{
		$sql="select * from $this->tb where isgif=1";
		return $this->db->getAll($sql);
	}
	public function getclassic()
	{
		$sql="select * from $this->tb where isgif=0";
		return $this->db->getAll($sql);
	}
	
	public function getrow($id)
	{
		$sql="select * from $this->tb where id=$id";
		return $this->db->getRow($sql);
	}

}